Takes the player to another world (0 is the first world in your list, 1 the second), to the place (x, y) of that world, with a room change that plays a transition: the one you give as the fourth value, or the usual one when you leave it out. Each world keeps its own memory: what was opened or taken, the changed tiles. Going back to a world finds it as it was left.
world_go(world, x, y, transition = default)| Name | Type |
|---|---|
world | int |
x | real |
y | real |
transition | transition (can be left out; then it is default) |
Nothing.
Takes the player to another world, to the place (x, y) of that world (counted from its top-left corner), with a room change that plays a transition. world is a number: 0 is the first world in your list, 1 the second, and so on. The optional fourth value is the transition to play, written the way it is for room_change_ext: a kind on its own such as fade_to_black or iris, or a kind with a direction such as wavy_wipe.north. Leave it out and the usual fade plays.
Each world has its own memory. What the player opened or took in one world, and the tiles the game changed there, stay as they were when the player is somewhere else, and are found again on the way back. Going to a world and back loses nothing.
Only the player makes the trip. The new world does not make a second player. A change from one world to another is never seamless, because two worlds do not share an edge.
Does nothing if a room change is already in progress, or if there is no world with that number.
if (btn_pressed(BTN_A) && dist_to(x, y, 300, 120) < 16) {
world_go(1, 100, 100);
}Standing on the cave mouth and pressing A takes the player to the place 100, 100 of the second world, with the usual fade.
world_go(1, 100, 100, iris);The same trip, closing and opening like an iris instead.
You do not have to write the call yourself. In the Room Editor, a world has the same Doors list a room has: press + Add Door, click where the door goes in the world, pick the room (or another world) it leads to, then click where its other end goes. The two doors are linked both ways, like any pair of doors.
world_go to that place, and the transition picked for the door plays. If you have made the world's regions play a song or fire an event, they do it then too.Only the player comes with you (the player object of that world, which is the one that is already playing: the new world does not make another). A change from one world to another is never seamless, since two worlds do not share an edge. The transition is written like the one of room_change_ext: a kind on its own (fade_to_black, iris, ...), kind.direction for the five directional kinds, or, in the code of a door, self.send_transition. Does nothing when a room change is already in progress or the number is not a world of the game.